package masterjava.client;

import com.extjs.gxt.ui.client.widget.Component;
import com.extjs.gxt.ui.client.widget.ContentPanel;
import masterjava.common.client.gxt.base.BaseEntryPoint;
import masterjava.common.client.gxt.base.RootLayout;
import masterjava.common.client.gxt.highstock.HighStockType;

abstract public class GxtTestEntryPoint extends BaseEntryPoint {

    @Override
    protected void load(RootLayout rootLayout) {
        rootLayout.setAppTitle("Gxt Test");
        HighStockType.init(
                "{ INTRADAY: {" +
                        "params: {\n" +
                        "    xAxis: {\n" +
                        "        type: 'datetime',\n" +
                        "        maxZoom: 3600000 // one hour\n" +
                        "    },\n" +
                        "    yAxis: [\n" +
                        "        {\n" +
                        "            title: {\n" +
                        "                text: 'Closing'\n" +
                        "            },\n" +
                        "            height: 200,\n" +
                        "            lineWidth: 2\n" +
                        "        },\n" +
                        "        {\n" +
                        "            title: {\n" +
                        "                text: 'Volume'\n" +
                        "            },\n" +
                        "            top: 300,\n" +
                        "            height: 100,\n" +
                        "            offset: 0,\n" +
                        "            lineWidth: 2\n" +
                        "        }\n" +
                        "    ],\n" +
                        "\n" +
                        "    rangeSelector: {\n" +
                        "        buttons: [\n" +
                        "            {\n" +
                        "                type: 'minute',\n" +
                        "                count: 15,\n" +
                        "                text: '15m'\n" +
                        "            },\n" +
                        "            {\n" +
                        "                type: 'hour',\n" +
                        "                count: 1,\n" +
                        "                text: '1h'\n" +
                        "            },\n" +
                        "            {\n" +
                        "                type: 'all',\n" +
                        "                count: 1,\n" +
                        "                text: 'All'\n" +
                        "            }\n" +
                        "        ],\n" +
                        "        selected: 1,\n" +
                        "        inputEnabled: false\n" +
                        "    }" +
                        "}," +
                        "title: 'Intraday'}}");

        ContentPanel requestPanel = new ContentPanel();
        requestPanel.setHeading("Tree");
        rootLayout.setNavigation(requestPanel);
        rootLayout.setContent(getContent());
    }

    abstract protected Component getContent();
}
